#pragma once
#include "BinaryReader.h"
#include "BinExportTypes.h"
class MeshList;
class IniFile;
class ObjMesh;
class MaterialReader;
class Skeleton;
/**
* Reads the binary object files.
* @author Koen Samyn
*/
class BinObjReader:public BinaryReader
{
public:
	/**
	* Creates a Binary Object Reader.
	* @param device the device to create the vertex buffers with.
	* @param gameConfig the iniFile object that provides the necessary
	* directory information.
	* @param fileName the relative file name for the mesh.
	*/
	BinObjReader(IniFile* gameConfig,tstring fileName);
	/**
	* Destroys the binary obj reader object.
	*/ 
	virtual ~BinObjReader(void);
	/**
	* Reads the contents of the file.
	*/
	bool Read();
	/**
	* Reads a vertex list
	*/
	/**
	* Returns the MeshList object.
	* @return the contents of the obj file.
	*/
	MeshList* GetMeshList(){
		return m_pMeshList;
	}
	/**
	* Reads the material file.
	*/
	void ReadMaterialFile();
	/**
	* Reads a binary vertex list.
	*/
	void ReadVertexList();
	/**
	* Reads a binary triangle list.
	*/
	void ReadTriangleList();
private:
	/**
	* The game configuration file.
	*/
	IniFile* m_pGameConfig;
	/**
	* The mesh list with the list of meshes.
	*/
	MeshList* m_pMeshList;
	/**
	* The current mesh object
	*/
	ObjMesh* m_pCurrentMesh;
	/**
	* nr of bytes read.
	*/
	int m_NrOfBytesRead;
	/**
	* The absolute texture directory.
	*/
	tstring m_TextureDir;
	/**
	* The absolute skeleton directory.
	*/
	tstring m_RigDir;
	/**
	* The material reader object.
	*/
	MaterialReader* m_pMaterialReader;
	/**
	* The current skeleton
	*/
	Skeleton* m_pCurrentSkeleton;
	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------
	BinObjReader(const BinObjReader& t);
	BinObjReader& operator=(const BinObjReader& t);
};
